package commRedisTag

import "time"

var (
	reader   *redisTagReader
	writer   *redisTagWriter
	Service  *redisTagService
	SaveMode bool
)

func init() {
	reader = &redisTagReader{}
	writer = &redisTagWriter{}

	Service = &redisTagService{}
	Service.producerData = make(map[string]interface{})
	Service.consumerData = make(map[string]interface{})
}

// Scheduler 创建一个线程
func Scheduler() {
	go scheduler()
}

// 线程函数
func scheduler() {
	for true {
		time.Sleep(1 * time.Second)

		if SaveMode {
			Service.save()
		} else {
			Service.load()
		}
	}
}
